<template>
  <div class="mainRight">
    <div class="usertop">
      <div class="userHead">
        <img :src="avatar" alt="">
      </div>
      <span>{{ stu_name }}</span>
      <span>积分值：{{ stu_fen }}</span>
    </div>
    <router-link to="/personal">
      <div class="botText">
        <span><span class="iconfont">&#xe65a;</span>  我的提问</span>
        <span><span class="iconfont">&#xe65a;</span>  我的回答</span>
        <span><span class="iconfont">&#xe65a;</span>  我关注的问题</span>
      </div>
    </router-link>

    <div class="tags">
      <div class="tagsbt">
        <h4>热门标签</h4>
        <span>全部标签 ></span>
      </div>
      <div class="tagCon">
        <el-tag>标签一</el-tag>
        <el-tag type="success">HTML</el-tag>
        <el-tag type="info">Vue</el-tag>
        <el-tag type="warning">Koa</el-tag>
        <el-tag type="danger">Node</el-tag>
        <el-tag type="danger">SQL</el-tag>
        <el-tag type="danger">Element-Ui</el-tag>
      </div>
      <div class="userbang">
        <h4>本周排行榜</h4>
        <el-tabs v-model="activeName" >
          <el-tab-pane label="优质回答" name="first">
            <ul>
              <li v-for="(item, idx) in goodUser" :key="idx" class="headlist">
                <div class="headlistleft">
                  <span class="iconfont tagbts">&#xe669;</span>
                  <div class="userHead">
                    <img :src="item.img" alt="">
                  </div>
                  <span>{{ item.name }}</span>
                </div>
                <span >{{ item.grade }}</span>
              </li>
            </ul>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>
<script>
import store from '@/store'
export default {
  name: 'Sidebar',
  data() {
    return {
      activeName: 'first',
      stu_fen: '',
      stu_name: '',
      avatar: require('@/assets/home/01.jpg'),
      goodUser: [{
        img: require('@/assets/home/01.jpg'),
        name: '鱼的记忆',
        grade: 100
      },
      {
        img: require('@/assets/home/002.jpg'),
        name: '一点寒芒',
        grade: 88
      },
      {
        img: require('@/assets/home/003.jpg'),
        name: '小妖同学',
        grade: 100
      },
      {
        img: require('@/assets/home/004.jpg'),
        name: '你的电话',
        grade: 100
      }]
    }
  },
  created: function() {
    store.dispatch('GetInfo').then((res) => {
      this.stu_fen = res.data.stu_fen
      this.stu_name = res.data.stu_name
      this.avatar = res.avatar
    })
  }
}
</script>
<style lang="scss" scoped>
ul, li {
  margin: 0;
  padding: 0;
  list-style: none;
}
.mainRight {
  width: 320px;
  height: 210px;
  background: #fff;
  margin-top: 58px;
  padding-left: 20px;
  position: relative;
  font-size: 14px;
  color: #323232;
  .usertop {
    width: 100%;
    height: 80px;
    line-height: 80px;
    span {
      margin-left: 20px;
      font-size: 16px;
    }
    .userHead {
      width: 60px;
      height: 60px;
      overflow: hidden;
      border-radius: 30px;
      float: left;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .botText {
    height: 100px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .tags {
    margin-top: 20px;
    .tagsbt {
      width: 100%;
      height: 50px;
      line-height: 50px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      h4 {
        font-size: 16px;
        color: #636363;
      }
      span {
        font-size: 12px;
        color: #959595;
      }
    }
    .tagCon {
      width: 100%;
      span {
        margin-top: 10px;
      }
    }
    .userbang {
      .headlist {
        display: flex;
        width: 100%;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-weight: 700;
        .headlistleft {
          width: 60%;
          display: flex;
          align-items: center;
          justify-content: space-between;
        }
      }
      h4 {
        font-size: 16px;
        color: #636363;
      }
      .tagbts {
        color: #f56c6c;
        font-size: 20px;
      }
      .userHead {
        width: 60px;
        height: 60px;
        border-radius: 30px;
        overflow: hidden;
        margin-left: 10px;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>
